<?php 
require_once $_SERVER["DOCUMENT_ROOT"]."/inc/core/env.inc.php";

$return["success"] = false; 
$return["html"] = null;
$return["error"] = null;

if ($_USER->asPermission('mod_page')){
	$return["success"] = true;
	
	$_PAGE = new Page(null, $_POST['idPage']);
	$_TRANSLATE = new Translator();
	
	foreach ($_PAGE->get('blocks') as $i => $bId) {
		$block = new Block($bId);
		$content = "<br /><br /><br />";
		$return['html'] .= $_ADMIN::createWindow($block->get('name'), $content, "page");
		//$return["html"] .= '<li>'.$block->get('name').'</li>';
	}
}

echo '('.json_encode($return).')';
?>